const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 1; i <= 20; i++) content.push({
        id: `${i}`,
        dealerCode: 'string',
        dealerName: 'string',
        partContractInvoiceCode: `FP201902125145${i}`,
        invoicedDate: '2019-04-17T05:13:36.246Z',
        shipmentType: 1,
        paymentType: 1,
        priceTerms: 1,
        invoiceAmount: 10980,
        status: 1,
        rowVersion: 'string',
        options: [
            'update', 'abandon'
        ]
    });
    res.json(
        {
            message: '',
            payload: {
                content,
                totalElements: 100,
            }
        }
    );
});

router.get('/:id', (req, res) => {
    res.json({
        payload: {
            id: '1',
            code: 'code',
            dealerCode: 'string',
            dealerName: 'string',
            partContractInvoiceCode: 'FP2019021251451',
            invoicedDate: '2019-04-17T05:13:36.246Z',
            shipmentType: 1,
            priceTerms: 1,
            invoiceAmount: 10980,
            options: [
                'update', 'abandon'
            ],
            partInvoiceId: '1',
            shipmentNumber: 'YS20190908001',
            country: '巴西',
            currency: 1,
            origin: 'origin-string',
            destination: 'destination-string',
            declarePlace: 1,
            declareType: 1,
            lcCode: 'XYZ007',
            isLcl: true,
            shortContainerCount: 1,
            standardContainerCount: 2,
            highContainerCount: 3,
            rowVersion: 'string',
            details: [
                {
                    id: '1',
                    packingListCode: 'XD20190908001',
                    partSaleOrderCode: 'XSDD201909080001',
                    shipmentDate: 50,
                    currency: 1,
                    partCode: 'PJ-01',
                    partName: '配件01',
                    quantity: 10,
                    price: 998,
                    totalAmount: 10000,
                    group: 1
                }, {
                    id: '2',
                    packingListCode: 'XD20190908001',
                    partSaleOrderCode: 'XSDD201909080001',
                    shipmentDate: 50,
                    currency: 1,
                    partCode: 'PJ-02',
                    partName: '配件02',
                    quantity: 10,
                    price: 998,
                    totalAmount: 10000,
                    group: 1
                }, {
                    id: '3',
                    packingListCode: 'XD20190908002',
                    partSaleOrderCode: 'XSDD201909080002',
                    shipmentDate: 50,
                    currency: 1,
                    partCode: 'PJ-02',
                    partName: '配件02',
                    quantity: 10,
                    price: 998,
                    totalAmount: 10000,
                    group: 2
                }, {
                    id: '4',
                    packingListCode: 'XD20190908002',
                    partSaleOrderCode: 'XSDD201909080002',
                    shipmentDate: 50,
                    currency: 1,
                    partCode: 'PJ-02',
                    partName: '配件02',
                    quantity: 10,
                    price: 998,
                    totalAmount: 10000,
                    group: 2
                }, {
                    id: '5',
                    packingListCode: 'XD20190908003',
                    partSaleOrderCode: 'XSDD201909080003',
                    shipmentDate: 50,
                    currency: 1,
                    partCode: 'PJ-03',
                    partName: '配件03',
                    quantity: 10,
                    price: 998,
                    totalAmount: 10000,
                    group: 3
                }
            ]
        }
    });
});
router.post('/', (req, res) => {
    res.json({
        message: 'success'
    });
});
router.put('/:id', (req, res) => {
    res.json({
        message: 'success'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: 'success'
    });
});

module.exports = router;
